Socket
Socket
Sign inDemoInstall

stringify-attributes

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stringify-attributes

Turn an object into a string of HTML attributes


Version published
Maintainers
1
Created
Source

stringify-attributes Build Status

Turn an object into a string of HTML attributes

Install

$ npm install stringify-attributes

Usage

const stringifyAttributes = require('stringify-attributes');

stringifyAttributes({
	unicorn: '🦄',
	rainbow: true,
	number: 1,
	multiple: [
		'a',
		'b'
	]
});
//=> ' unicorn="🦄" rainbow number="1" multiple="a b"'

Note that the string is prepended with a space when there are attributes to simplify using it in a HTML tag.

License

MIT © Sindre Sorhus

Keywords

FAQs

Package last updated on 28 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc